package com.atguigu.springboot.service.impl;

import com.atguigu.springboot.service.IScheduledService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/02 17:56 周三
 * @description :
 */
@Service
public class ScheduledServiceImpl implements IScheduledService {

    /**
     * second, minute, hour, day of month, month, and day of week.
     * cron = "0 * * * * MON-THU"               => 0秒 周一到周四
     * cron = "0,1,2,3,4 * * * * MON-THU"       => 0,1,2,3,4 秒 周一到周四
     * cron = "0-20 * * * * MON-THU"            => [0,20]秒 周一到周四
     * cron = "0/4 * * * * MON-THU"             => 从0秒开始每4秒启动一次 周一到周四
     */
    @Scheduled(cron = "0/4 * * * * MON-THU")
    @Override
    public void hello() {
        System.out.println("hello....");
    }
}
